package com.tanglongan.designPattern.dp07_bridge.demo99;

public class GenericClient {

    /**
     * 抽象实现
     */
    interface IImplementor {
        void operationImpl();
    }

    /**
     * 具体实现A
     */
    static class ConcreteImplementorA implements IImplementor {
        @Override
        public void operationImpl() {
            System.out.println("ConcreteImplementorA");
        }
    }

    /**
     * 具体实现B
     */
    static class ConcreteImplementorB implements IImplementor {
        @Override
        public void operationImpl() {
            System.out.println("ConcreteImplementorB");
        }
    }

    /**
     * 抽象
     */
    static abstract class Abstraction {
        IImplementor implementor;

        public Abstraction(IImplementor implementor) {
            this.implementor = implementor;
        }

        public void operation() {
            this.implementor.operationImpl();
        }
    }

    /**
     * 修正抽象
     */
    static class RefinedAbstraction extends Abstraction {
        public RefinedAbstraction(IImplementor implementor) {
            super(implementor);
        }
        @Override
        public void operation() {
            super.operation();
            System.out.println("refined operation");
        }
    }
}
